<template>
    <div>
        <div class="post-head">
            <div>
                <span :class="['head-item',{'active':show[0]}]" @click="showDiv(0)">流程表单</span>
                <span :class="['head-item',{'active':show[1]}]" @click="showDiv(1)">流程图</span>
                <span :class="['head-item',{'active':show[2]}]" @click="showDiv(2)">流程状态</span>
            </div>
            <div class="post-button-all">
                <el-button class="post-button" size="mini" @click="submitForm">提交</el-button>
                <el-button class="post-button" size="mini">保存</el-button>
            </div>
        </div>
        <div class="division"></div>
        <div>
            <div v-show="show[0]">
                <div class="form-head">桐庐县江南镇人民政府发文稿纸</div>
                <div>
                    <el-form class="form" ref="elForm" :model="formData" :rules="rules" size="medium" label-width="85px" label-position="left">
                        <div class="form-border1">
                            <div class="form-first">
                                <el-form-item label="签发:" prop="issue" class="main-box-content">
                                    <el-input v-model="formData.issue" clearable :style="{width: '100%'}"></el-input>
                                </el-form-item>
                                <el-form-item label="会签:" prop="countersign" class="main-box-content">
                                    <el-input v-model="formData.countersign" clearable :style="{width: '100%'}">
                                    </el-input>
                                </el-form-item>
                            </div>
                            <div class="form-second">
                                <el-form-item label="核稿:" prop="review" class="second-item1">
                                    <el-input v-model="formData.review" clearable :style="{width: '50%'}"></el-input>
                                </el-form-item>
                                <el-form-item label="主办单位:" prop="organizer" class="second-item2">
                                    <el-input v-model="formData.organizer" clearable :style="{width: '50%'}">
                                    </el-input>
                                </el-form-item>
                                <el-form-item label="拟稿人:" prop="drafter" class="second-item2">
                                    <el-input v-model="formData.drafter" clearable :style="{width: '50%'}">
                                    </el-input>
                                </el-form-item>
                            </div>
                        </div>
                        <div class="form-border2">
                            <div class="form-thired">
                                <el-form-item label="事由:" prop="matter" class="thired-item">
                                    <el-input v-model="formData.matter" clearable :style="{width: '100%'}"></el-input>
                                </el-form-item>
                            </div>
                            <div class="form-four">
                                <el-form-item label="附件:" prop="annex" class="four-item">
                                    <el-input v-model="formData.annex" clearable :style="{width: '50%'}"></el-input>
                                </el-form-item>
                            </div>
                        </div>
                        <div class="form-border2">
                            <div class="form-thired">
                                <el-form-item label="主送机关:" prop="mainOffice" class="thired-item">
                                    <el-input v-model="formData.mainOffice" clearable :style="{width: '100%'}">
                                    </el-input>
                                </el-form-item>
                            </div>
                            <div class="form-four">
                                <el-form-item label="抄送机关:" prop="copyOffice" class="four-item">
                                    <el-input v-model="formData.copyOffice" clearable :style="{width: '50%'}">
                                    </el-input>
                                </el-form-item>
                            </div>
                        </div>

                        <div class="form-border3">
                            <el-form-item label="打字:" prop="typing">
                                <el-input v-model="formData.typing" clearable :style="{width: '100%'}"></el-input>
                            </el-form-item>
                            <el-form-item label="校对:" prop="proof">
                                <el-input v-model="formData.proof" clearable :style="{width: '100%'}"></el-input>
                            </el-form-item>
                            <div class="form-five">
                                <el-form-item label="共印" prop="Printing" style="margin-right:10px;width:50%">
                                    <el-input v-model="formData.Printing" clearable :style="{width: '100%'}">
                                    </el-input>
                                </el-form-item>
                                <span style="margin-top:5px;">份</span>
                            </div>
                        </div>
                        <div class="form-border3">
                            <el-form-item label="文号:" prop="number">
                                <el-input v-model="formData.number" clearable :style="{width: '100%'}"></el-input>
                            </el-form-item>
                            <div class="form-five">
                                <el-form-item label=" " prop="date" style="margin-right:10px;">
                                    <el-date-picker v-model="formData.date" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                                    :style="{width: '100%'}" placeholder="封发日期" clearable></el-date-picker>
                                </el-form-item>
                                <span style="margin-top:5px;margin-right:120px">封发</span>
                            </div>
                        </div>

                    </el-form>
                </div>
            </div>
            <div v-show="show[1]">流程图</div>
            <div v-show="show[2]">流程状态</div>
        </div>
        <div class="division2"></div>
    </div>
</template>

<script>
export default {
    data () {
        return {
            show: [true,false,false],
            formData: {
                issue: undefined,
                review: undefined,
                countersign: undefined,
                organizer: undefined,
                drafter: undefined,
                matter: undefined,
                annex: undefined,
                mainOffice: undefined,
                copyOffice: undefined,
                typing: undefined,
                proof: undefined,
                Printing: undefined,
                number: undefined,
                date: null,
            },
            rules: {
                issue: [{
                required: true,
                message: '请输入签发',
                trigger: 'blur'
                }],
                review: [{
                required: true,
                message: '请输入核稿',
                trigger: 'blur'
                }],
                organizer: [{
                required: true,
                message: '请输入主办单位',
                trigger: 'blur'
                }],
                drafter: [{
                required: true,
                message: '请输入拟稿人',
                trigger: 'blur'
                }],
                matter: [{
                required: true,
                message: '请输入事由',
                trigger: 'blur'
                }],
                annex: [{
                required: true,
                message: '请输入附件',
                trigger: 'blur'
                }],
                mainOffice: [{
                required: true,
                message: '请输入主送机关',
                trigger: 'blur'
                }],
                copyOffice: [{
                required: true,
                message: '请输入抄送机关',
                trigger: 'blur'
                }],
                Printing: [],
                number: [{
                required: true,
                message: '请输入文号',
                trigger: 'blur'
                }],
                date: [{
                required: true,
                message: '请选择 ',
                trigger: 'change'
                }],
            },
        }
    },
    methods: {
        showDiv(index) {
            for (let i = 0; i < this.show.length; i++) {
                if (i == index) {
                    this.show.splice(i, 1, true)
                }else{
                    this.show.splice(i, 1, false)
                }
            }
        },
        submitForm() {
            this.$refs['elForm'].validate(valid => {
                if (!valid) return
                // TODO 提交表单
            })
        },
    }
}
</script>

<style scoped>
    .post-head{
        width: 100%;
        display: flex;
        justify-content: space-between;
        font-weight: 500;
    }
    /* 按钮区域样式 */
    .post-button-all{
        margin-right: 60px;
    }
    /* 单个按钮样式 */
    .post-button{
        background-color: rgb(60, 136, 172);
        color: white;
        border-radius: 5px;
    }
    .head-item{
        margin-left: 25px;
        cursor:pointer;
        padding-left: 10px;
        padding-right: 10px;
    }
    .active{
        border-bottom: 2px solid rgb(52, 186, 240);
    }
    /* 分割线 */
    .division{
        width: 100%;
        margin: 0 auto;
        height: 2px;
        background-color: rgb(209, 208, 208);
        margin-top: 5px;
        margin-bottom: 15px;
    }
    /* 分割线2 */
    .division2{
        width: 100%;
        margin: 0 auto;
        height: 2px;
        background-color: rgb(209, 208, 208);
        margin-top: 25px;
        margin-bottom: 15px;
    }
    /* 发文稿纸头部标题 */
    .form-head{
        color: rgb(255, 0, 0);
        font-size: 18px;
        text-align: center;
    }
    .form{
        width: 80%;
        margin: 0 auto;
        color: rgb(255, 0, 0);
    }
    .form-border1{
        border-top: 2px solid rgb(255, 0, 0);
        border-bottom: 2px solid rgb(255, 0, 0);
        margin-top: 20px;
        display: flex;
        justify-content: space-between;
    }
    .el-form-item__label{
        color: rgb(255, 0, 0);
    }
    
    .form-first{
        display: -webkit-box;
        -webkit-box-orient: vertical;   /*属性值：[horizontal]横向/[vertical]纵向*/
        align-items: center;
        padding-left: 100px;
    }
    .main-box-content{
        -webkit-box-flex: 1;
        margin-top: 10%;
    }
    .form-second{
        border-left: 2px solid rgb(255, 0, 0);
        width: 50%;
    }
    .second-item1{
        border-bottom: 2px solid rgb(255, 0, 0);
        padding-left: 30px;
        height: 60px;
        line-height: 50px;
        margin-top: 4%;
    }
    .second-item2{
        padding-left: 30px;
    }
    .form-border2{
        display: flex;
        justify-content: space-between;
        border-bottom: 2px solid rgb(255, 0, 0);
    }
    .form-thired{
        padding-left: 100px;
    }
    .form-four{
        border-left: 2px solid rgb(255, 0, 0);
        width: 50%;
    }
    .thired-item{
        margin-top: 8%;
    }
    .four-item{
        margin-top: 4%;
        padding-left: 30px;
    }
    .form-border3{
        display: flex;
        justify-content: space-between;
        border-bottom: 2px solid rgb(255, 0, 0);
        padding-left: 100px;
        padding-top: 2%;
    }
    .form-five{
        display: flex;
    }
</style>